package com.sx.wechat.command.api;

import com.sx.core.model.Information;
import com.sx.core.mybatis.SessionTemplate;
import com.sx.core.page.Page;
import com.sx.core.vo.JsonReaderResponse;
import com.sx.core.vo.Params;
import com.sx.wechat.command.cmd.AbstractCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 挂失解挂
 * Created by lihao on 2018/3/21.
 */
@Component("list_student")
public class List_student extends AbstractCommand {
    @Autowired
    SessionTemplate sessionTemplate;
    @Override
    public Object executeApi(HttpServletRequest request, HttpServletResponse response) {
        int page=obtainPage(request);
        int limit=obtainLimit(request);
        String classid=obtain(request,"classid");
        Page<Information> listPage=sessionTemplate.listPage(Information.class,"select_list",page,10000,new Params().p("type","1").p("classid",classid));
        return new JsonReaderResponse(listPage.getContent(),listPage.getTotalElements());
    }
}
